<template>
	<view class="container">		
		<view class="nav" :style="'height:'+TitleHeight+'px;'">
			<view class="menu" :style="'opacity:'+Opacity"></view>
			<view class="back" :style="'bottom:'+(TitleBottom+3)+'px'" @click="Back"><image src="/static/sort1.png" /></view>
			<view class="title" :style="'bottom:'+TitleBottom+'px'">{{TitleList[Step-1]}}</view> 
		</view>
		<view class="error" v-if="Info.State==1">资料正在审核中，通过后将公开展示</view>
		<view class="error" v-if="Info.State==3">审核失败{{Info.Reason==''?'':'，'+Info.Reason}}</view>		
		<view class="square">
			<form @submit="formSubmit">
				<view class="promise">填表人承诺：以下资料均为真实，并保证本人确属单身。如因本人提供的信息虚假而造成的一切后果，均由本人承担全部法律责任！</view>
				<view class="aware border-b">注意：红色内容为必填项！</view>
				<view class="step1" :class="Step==1?'':'hidden'">
					<view class="head border-b">
						<view class="title red">上传{{Role==0?'':'孩子的'}}头像</view>
						<view class="upload" @click="ChooseHeadImg()"><image src="/static/uphead.png" v-if="Info.HeadImg.indexOf('headimg.png')>-1" /><image :src="Tools.GetImg(Info.HeadImg,200)" v-else mode="aspectFill"/></view>
						<view class="tip">上传近期美照可更引人关注哦~</view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}昵称</view>
						<input name="NickName" placeholder="请输入昵称" :value="Info.NickName"></input>
					</view>											
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'家长'}}手机号码</view>
						<input name="Mobile" type="number" :placeholder="'请输入'+(Role==0?'':'家长')+'手机号码'" :value="Info.Mobile" maxlength="11"></input>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'家长'}}微信号</view>
						<input name="WeiXin" :placeholder="'请输入'+(Role==0?'':'家长')+'微信号'" :value="Info.WeiXin"></input>
					</view> 
					<view class="card border-b">
						<view class="title red">上传{{Role==0?'':'孩子'}}身份证</view>
						<view class="idcard" @click="ChooseIDCardA()">
							<image v-if="Info.IDCardA==''" src="http://download.qiyedaishu.com/common/zheng.png" />
							<image v-else :src="Tools.GetImg(Info.IDCardA,200)" mode="aspectFill"/>
						</view>
						<view class="idcard" @click="ChooseIDCardB()">
							<image v-if="Info.IDCardB==''" src="http://download.qiyedaishu.com/common/fan.png" />
							<image v-else :src="Tools.GetImg(Info.IDCardB,200)" mode="aspectFill"/>
						</view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}姓名</view>
						<input name="RealName" placeholder="上传完身份证后自动识别" :value="Info.RealName"></input>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}性别</view>
						<picker @change="SexChange" :value="Tools.findStringIndex(SexList,Info.Sex)" :range="SexList">
							<view class="uni-input" style="height: 60rpx; line-height: 60rpx;">
								{{SexList[Tools.findStringIndex(SexList,Info.Sex)]}}<input name="Sex" type="text" class="hidden" :value="Info.Sex"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子'}}身份证号</view>
						<input name="IDCard" type="idcard" placeholder="上传完身份证后自动识别" :value="Info.IDCard" maxlength="18"></input>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}出生日期</view>
						<picker name="Birthday" mode="date" :value="Tools.toDate(Info.Birthday,'上传完身份证后自动识别')" @change="BirthdayChange">
							<view class="uni-input">{{Tools.toDate(Info.Birthday,'上传完身份证后自动识别')}}</view><input name="Birthday" type="text" class="hidden" :value="Info.Birthday"/>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}身高</view>
						<picker @change="StatureChange" :value="Tools.findSameIndex(StatureList,Info.Stature)" :range="StatureList">
							<view class="uni-input">
								{{StatureList[Tools.findSameIndex(StatureList,Info.Stature)]}}<input name="Stature" type="text" class="hidden" :value="Info.Stature"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}体重</view>
						<picker @change="WeightChange" :value="Tools.findSameIndex(WeightList,Info.Weight)" :range="WeightList">
							<view class="uni-input">
								{{WeightList[Tools.findSameIndex(WeightList,Info.Weight)]}}<input name="Weight" type="text" class="hidden" :value="Info.Weight"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}民族</view>
						<picker @change="NationChange" :value="Tools.findStringIndex(NationList,Info.Nation)" :range="NationList">
							<view class="uni-input">
								{{NationList[Tools.findStringIndex(NationList,Info.Nation)]}}<input name="Nation" type="text" class="hidden" :value="Info.Nation"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'孩子的'}}出生地</view>
						<view class="text-r">
							<uni-citypicker v-if="Info.ID" @change="BirthPlaceChange" placeholder="请选择" :type="1" :provinceid="Info.BirthPlaceProvinceID" :cityid="Info.BirthPlaceCityID"></uni-citypicker>
							<input name="BirthPlaceProvinceID" type="text" class="hidden" :value="Info.BirthPlaceProvinceID"/>
							<input name="BirthPlaceCityID" type="text" class="hidden" :value="Info.BirthPlaceCityID"/>
							<input name="BirthPlace" type="text" class="hidden" :value="Info.BirthPlace"/>
						</view>
						<view class="arrow"></view>
					</view>					
				</view>
				<view class="step2" :class="Step==2?'':'hidden'">
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}年收入</view>
						<picker @change="IncomeChange" :value="Tools.findStringIndex(IncomeList,Info.Income)" :range="IncomeList">
							<view class="uni-input">
								{{IncomeList[Tools.findStringIndex(IncomeList,Info.Income)]}}<input name="Income" type="text" class="hidden" :value="Info.Income"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}最高学历</view>
						<picker @change="EducationChange" :value="Tools.findStringIndex(EducationList,Info.Education)" :range="EducationList"  :disabled="Info.IsEducation==1?'disabled':''">
							<view class="uni-input">
								{{EducationList[Tools.findStringIndex(EducationList,Info.Education)]}}<input name="Education" type="text" class="hidden" :value="Info.Education"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>	
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子'}}从事的职业</view>
						<picker @change="WorkRoleChange" :value="Tools.findStringIndex(WorkRoleList,Info.WorkRole)" :range="WorkRoleList">
							<view class="uni-input">
								{{WorkRoleList[Tools.findStringIndex(WorkRoleList,Info.WorkRole)]}}<input name="WorkRole" type="text" class="hidden" :value="Info.WorkRole"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'孩子的'}}专业</view>
						<picker @change="ProfessionChange" :value="Tools.findStringIndex(ProfessionList,Info.Profession)" :range="ProfessionList">
							<view class="uni-input">
								{{ProfessionList[Tools.findStringIndex(ProfessionList,Info.Profession)]}}<input name="Profession" type="text" class="hidden" :value="Info.Profession"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'孩子的'}}行业</view>
						<picker @change="IndustryChange" :value="Tools.findStringIndex(IndustryList,Info.Industry)" :range="IndustryList">
							<view class="uni-input">
								{{IndustryList[Tools.findStringIndex(IndustryList,Info.Industry)]}}<input name="Industry" type="text" class="hidden" :value="Info.Industry"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'孩子的'}}职业属性</view>
						<picker @change="VocationChange" :value="Tools.findStringIndex(VocationList,Info.Vocation)" :range="VocationList">
							<view class="uni-input">
								{{VocationList[Tools.findStringIndex(VocationList,Info.Vocation)]}}<input name="Vocation" type="text" class="hidden" :value="Info.Vocation"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子的'}}工作区域</view>
						<view class="text-r">
							<uni-citypicker v-if="Info.ID" @change="WorkPlaceChange" placeholder="请选择" :type="3" :provinceid="Info.WorkPlaceProvinceID" :cityid="Info.WorkPlaceCityID" :areaid="Info.WorkPlaceAreaID"></uni-citypicker>
							<input name="WorkPlaceProvinceID" type="text" class="hidden" :value="Info.WorkPlaceProvinceID"/>
							<input name="WorkPlaceCityID" type="text" class="hidden" :value="Info.WorkPlaceCityID"/>
							<input name="WorkPlaceAreaID" type="text" class="hidden" :value="Info.WorkPlaceAreaID"/>
							<input name="WorkPlace" type="text" class="hidden" :value="Info.WorkPlace"/>
						</view>
						<view class="arrow"></view>
					</view>
				</view>
				<view class="step3" :class="Step==3?'':'hidden'">
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子'}}是否有房</view>
						<picker @change="HouseChange" :value="Tools.findStringIndex(HouseList,Info.House)" :range="HouseList">
							<view class="uni-input">
								{{HouseList[Tools.findStringIndex(HouseList,Info.House)]}}<input name="House" type="text" class="hidden" :value="Info.House"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">{{Role==0?'':'孩子'}}是否有车</view>
						<picker @change="CarChange" :value="Tools.findStringIndex(CarList,Info.Car)" :range="CarList">
							<view class="uni-input">
								{{CarList[Tools.findStringIndex(CarList,Info.Car)]}}<input name="Car" type="text" class="hidden" :value="Info.Car"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'孩子'}}父母是否有退休金</view>
						<picker @change="PensionChange" :value="Tools.findStringIndex(PensionList,Info.Pension)" :range="PensionList">
							<view class="uni-input">
								{{PensionList[Tools.findStringIndex(PensionList,Info.Pension)]}}<input name="Pension" type="text" class="hidden" :value="Info.Pension"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'您孩子的'}}婚姻状况</view>
						<picker @change="MarriageChange" :value="Tools.findStringIndex(MarriageList,Info.Marriage)" :range="MarriageList" :disabled="Info.Marriage=='已结婚'?'disabled':''">
							<view class="uni-input">
								{{MarriageList[Tools.findStringIndex(MarriageList,Info.Marriage)]}}<input name="Marriage" type="text" class="hidden" :value="Info.Marriage"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'':'您孩子的'}}家庭状况</view>
						<picker @change="FamilyChange" :value="Tools.findStringIndex(FamilyList,Info.Family)" :range="FamilyList">
							<view class="uni-input">
								{{FamilyList[Tools.findStringIndex(FamilyList,Info.Family)]}}<input name="Family" type="text" class="hidden" :value="Info.Family"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">{{Role==0?'兄弟姐妹几人':'您孩子有几个兄弟姐妹'}}</view>
						<picker @change="BrotherChange" :value="Tools.findStringIndex(BrotherList,Info.Brother)" :range="BrotherList">
							<view class="uni-input">
								{{BrotherList[Tools.findStringIndex(BrotherList,Info.Brother)]}}<input name="Brother" type="text" class="hidden" :value="Info.Brother"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
				</view>
				<view class="step4" :class="Step==4?'':'hidden'">
					<view class="group">{{Role==0?'':'您孩子的'}}兴趣爱好 <text class="number">可多选</text></view>
					<view class="squarelist">
						<view class="line" :class="Info.Interest.split(',').indexOf(item)>-1?'select':''" @click="InterestClick(item)" v-for="item in InterestList">{{item}}</view>						
						<input name="Interest" type="text" class="hidden" :value="Info.Interest"/>
					</view>
				</view>
				<view class="step4" :class="Step==4?'':'hidden'">
					<view class="group">{{Role==0?'上传':'您孩子的'}}近期照片 <text class="number">{{OldList.length+ImgList.length}} / 9</text></view>
					<view class="imglist">
						<view class="img" v-for="(img,index) in OldList" @click="PrevImg(OldList, index)"><image :src="Tools.GetImg(img,200)" mode="aspectFill"/><view class="delete" @click="DeleteImg1(index)" @click.stop="" ><image src="/static/error.png"/></view></view>
						<view class="img" v-for="(img,index) in ImgList" @click="PrevImg(ImgList, index)"><image :src="img" mode="aspectFill"/><view class="delete" @click="DeleteImg2(index)" @click.stop=""><image src="/static/error.png"/></view></view>
						<view class="img bd" @click="ChooseImg"><image src="/static/addphoto.png" /></view>
					</view>
				</view>
				<view class="step5" :class="Step==5?'':'hidden'">
					<view class="group">{{Role==0?'你的':'您孩子的'}}择偶标准</view>
					<view class="slider border-b">
						<view class="title red">年龄</view>
						<view class="text">
							<slider-range :value="Info.OAge.ToArray()" :min="20" :max="80" :step="1" :bar-height="3" :block-size="20" background-color="#EEEEF6" active-color="#FF6B00" :format="format1" :decorationVisible="true" @change="OAgeChange"></slider-range>
							<input name="OAge" type="text" class="hidden" :value="Info.OAge"/>
						</view>
					</view>
					<view class="slider border-b">
						<view class="title red">身高</view>
						<view class="text">
							<slider-range :value="Info.OStature.ToArray()" :min="150" :max="200" :step="1" :bar-height="3" :block-size="20" background-color="#EEEEF6" active-color="#FF6B00" :format="format2" :decorationVisible="true" @change="OStatureChange"></slider-range>
							<input name="OStature" type="text" class="hidden" :value="Info.OStature"/>
						</view>						
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">学历</view>
						<picker @change="OEducationChange" :value="Tools.findStringIndex(OEducationList,Info.OEducation)" :range="OEducationList">
							<view class="uni-input">
								{{OEducationList[Tools.findStringIndex(OEducationList,Info.OEducation)]}}<input name="OEducation" type="text" class="hidden" :value="Info.OEducation"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">工作</view>
						<view class="text-r" @click="ShowOWorkRole">{{Info.OWorkRole==''?'请选择':Info.OWorkRole}}</view>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">婚姻状况</view>						
						<view class="text-r" @click="ShowOMarriage">{{Info.OMarriage==''?'请选择':Info.OMarriage}}</view>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">年收入</view>
						<picker @change="OIncomeChange" :value="Tools.findStringIndex(OIncomeList,Info.OIncome)" :range="OIncomeList">
							<view class="uni-input">
								{{OIncomeList[Tools.findStringIndex(OIncomeList,Info.OIncome)]}}<input name="OIncome" type="text" class="hidden" :value="Info.OIncome"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">是否有房</view>
						<picker @change="OHouseChange" :value="Tools.findStringIndex(OHouseList,Info.OHouse)" :range="OHouseList">
							<view class="uni-input">
								{{OHouseList[Tools.findStringIndex(OHouseList,Info.OHouse)]}}<input name="OHouse" type="text" class="hidden" :value="Info.OHouse"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">是否有车</view>
						<picker @change="OCarChange" :value="Tools.findStringIndex(OCarList,Info.OCar)" :range="OCarList">
							<view class="uni-input">
								{{OCarList[Tools.findStringIndex(OCarList,Info.OCar)]}}<input name="OCar" type="text" class="hidden" :value="Info.OCar"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title red">工作地区</view>
						<view class="text-r">
							<uni-citypicker v-if="Info.ID" @change="OWorkPlaceChange" placeholder="无要求" :type="1" :provinceid="Info.OWorkPlaceProvinceID" :cityid="Info.OWorkPlaceCityID"></uni-citypicker>
							<input name="OWorkPlaceProvinceID" type="text" class="hidden" :value="Info.OWorkPlaceProvinceID"/>
							<input name="OWorkPlaceCityID" type="text" class="hidden" :value="Info.OWorkPlaceCityID"/>
							<input name="OWorkPlace" type="text" class="hidden" :value="Info.OWorkPlace"/>
						</view>
						<view class="arrow"></view>
					</view>
					<view class="cu-form-group border-b">
						<view class="title">父母是否有退休金</view>
						<picker @change="OPensionChange" :value="Tools.findStringIndex(OPensionList,Info.OPension)" :range="OPensionList">
							<view class="uni-input">
								{{OPensionList[Tools.findStringIndex(OPensionList,Info.OPension)]}}<input name="OPension" type="text" class="hidden" :value="Info.OPension"/>
							</view>
						</picker>
						<view class="arrow"></view>
					</view>
					<view class="promise" style="margin-bottom:50rpx;">我承诺：本人相亲信息全部属实。若在参与平台相亲交友活动中发生的一切法律法规责任，均由本人承担。</view>
					<view class="agree border-b">
						<radio-group name="IsAgree">
							<label><view class="r1"><radio value="1" class="red" style="transform:scale(0.8)"/></view><view class="r2">确认同意</view></label>
							<label><view class="r1"><radio value="2" class="red" style="transform:scale(0.8)"/></view><view class="r2">弃权注册</view></label>
						</radio-group>
					</view>
				</view>
				<button class="login" form-type="submit">{{Step==5?"完成":"下一步"}}（{{Step}} / 5）</button>
				<view class="cancel" @click="Prev()">{{Step==1?"返回":"上一步"}}</view>
			</form>
		</view>
		<uni-popup ref="OWorkRole" type="bottom" backgroundColor="#ffffff">
			<view class="menutitle border-b">请选择工作（可多选）</view>
			<view class="checkbox">
				<view class="list" :class="Info.OWorkRole.indexOf(item)>-1?'select':''" @click="ChangeOWorkRole(item)" v-for="item in OWorkRoleList">{{item}}</view>
			</view>
		 	<view class="sheetmenu border-t" @click="CloseOWorkRole">确定</view>
		</uni-popup>
		<uni-popup ref="OMarriage" type="bottom" backgroundColor="#ffffff">
			<view class="menutitle border-b">请选择婚姻状况（可多选）</view>
			<view class="checkbox">
				<view class="list" :class="Info.OMarriage.indexOf(item)>-1?'select':''" @click="ChangeOMarriage(item)" v-for="item in OMarriageList">{{item}}</view>
			</view>
		 	<view class="sheetmenu border-t" @click="CloseOMarriage">确定</view>
		</uni-popup>
		<view class="flow" v-if="ShowFlow">
			<view class="meng" @click="CloseFlow"></view>
			<view class="img">
				<view class="flowimg"><image src="https://yuehuiba.qiyedaishu.com/img/flow1.jpg" /></view>
				<view class="close" @click="CloseFlow"><image src="/static/close.png"/></view>
			</view>
		</view>
	</view>	
</template>
<script>	
	export default {
		data() { 
			return {				
				Step:1,				
				Role:0,
				Opacity:0,
				TitleHeight: 0,
				TitleBottom: 0,
				TitleList:['基本资料','工作情况','家庭情况','生活照','择偶标准'],
				Info:{HeadImg:'', Sex:'男', Interest:'', Birthday:'',Stature:'', Brother:'', Weight:'', Education:'', WorkRole:'', Income:'', Profession:'', Industry:'', Vocation:'', House:'', Car:'', Pension:'', Marriage:'', Family:'', OWorkRole:'', ProvinceID:0, CityID:0, Province:'河南省', City:'郑州市'},
				SexList:['请选择','男','女'],
				StatureList:['请选择'],
				WeightList:['请选择'],
				NationList:['请选择'],
				IncomeList:['请选择'],
				EducationList:['请选择'],
				OEducationList:['请选择','无要求'],
				WorkRoleList:['请选择'],
				OWorkRoleList:['无要求'],				
				ProfessionList:['请选择'],
				IndustryList:['请选择'],
				VocationList:['请选择'],
				HouseList:['请选择'],
				OHouseList:['请选择','无要求'],
				CarList:['请选择'],
				OCarList:['请选择','无要求'],
				PensionList:['请选择'],
				OPensionList:['请选择','无要求'],
				MarriageList:['请选择'],
				OMarriageList:['无要求'],	
				OIncomeList:['请选择','无要求'],
				FamilyList:['请选择'],
				BrotherList:['请选择'],
				InterestList:[],
				OldList:[],
				ImgList:[],
				Error:false,
				Flag:'',
				ShowFlow:true
			};
		},
		onPageScroll(res) {
			this.Opacity=res.scrollTop/100;
		},
		onShow() {
			uni.$once("Cover",Path=>{
				this.Info.HeadImg=Path;
			});
		},
		onLoad(options) {
			if(options.Flag=="update"){
				this.ShowFlow=false;
			}
			var menu = this.Util.GetMenuHeight();
			this.TitleHeight = menu.height;
			this.TitleBottom = menu.bottom;
			this.Flag = options.Flag;
			this.Role = options.Role;
			this.Find_UserDetail();
		},
		methods:{
			CloseFlow(){
				this.ShowFlow=false;
			},
			format1(val) {
				return val + '岁'
			},
			format2(val) {
				return val + 'cm'
			},
			OpenOWorkRole(){
				this.$refs.OWorkRole.open()
			},
			OAgeChange(e) {
				this.Info.OAge=e.join('-');
			},
			OStatureChange(e) {
				this.Info.OStature=e.join('-');
			},
			ChangeOWorkRole(item){
				
				var OWorkRoleList=this.Info.OWorkRole.split(',');
				var NewList=[];
				if(this.Info.OWorkRole.indexOf(item)>-1){
					OWorkRoleList.Remove(item);
				}else{
					OWorkRoleList.push(item);
				}
				
				this.OWorkRoleList.forEach(o=>{
					if(OWorkRoleList.indexOf(o)>-1){
						NewList.push(o);
					}
				});
				this.Info.OWorkRole=NewList.join(',');
			},
			ChangeOMarriage(item){
				var OMarriageList=this.Info.OMarriage.split(',');
				var NewList=[];
				if(this.Info.OMarriage.indexOf(item)>-1){
					OMarriageList.Remove(item);
				}else{
					OMarriageList.push(item);
				}
				
				this.OMarriageList.forEach(o=>{
					if(OMarriageList.indexOf(o)>-1){
						NewList.push(o);
					}
				});
				this.Info.OMarriage=NewList.join(',');
			},
			
			ShowOWorkRole(){
				uni.hideKeyboard();
				this.$refs.OWorkRole.open();
			},
			CloseOWorkRole(){
				this.$refs.OWorkRole.close();
				
			},
			ShowOMarriage(){
				uni.hideKeyboard();
				this.$refs.OMarriage.open();
			},
			CloseOMarriage(){
				this.$refs.OMarriage.close();
				
			},			
			Prev(){
				if(this.Step==1){
					uni.navigateBack({
						delta:3
					})
				}else{
					this.Step--;
				}
			},
			Back(){
				uni.navigateBack();
			},
			SexChange(e){
				this.Info.Sex=this.SexList[e.detail.value];
				console.log(this.SexList[e.detail.value]);
				if(this.Info.Sex=="男" && this.Info.Stature==0){
					this.Info.Stature=175;
					this.Info.Weight=70;
				}
				if(this.Info.Sex=="女" && this.Info.Stature==0){
					this.Info.Stature=165;
					this.Info.Weight=55;
				}
			},
			StatureChange(e){
				this.Info.Stature=this.StatureList[e.detail.value];
			},
			WeightChange(e){
				this.Info.Weight=this.WeightList[e.detail.value];
			},
			NationChange(e){
				this.Info.Nation=this.NationList[e.detail.value];
			},
			BirthPlaceChange(e){
				this.Info.BirthPlaceProvinceID=e.value.ProvinceID;
				this.Info.BirthPlaceCityID=e.value.CityID;
				this.Info.BirthPlace=e.value.CityName;
			},
			CaccineChange(e){
				this.Info.Caccine=this.CaccineList[e.detail.value];
			},
			IncomeChange(e){
				this.Info.Income=this.IncomeList[e.detail.value];
			},
			WorkRoleChange(e){
				this.Info.WorkRole=this.WorkRoleList[e.detail.value];
			},
			ProfessionChange(e){
				this.Info.Profession=this.ProfessionList[e.detail.value];
			},
			EducationChange(e){
				this.Info.Education=this.EducationList[e.detail.value];
			},
			IndustryChange(e){
				this.Info.Industry=this.IndustryList[e.detail.value];
			},
			VocationChange(e){
				this.Info.Vocation=this.VocationList[e.detail.value];
			},
			WorkPlaceChange(e){
				this.Info.WorkPlaceProvinceID=e.value.ProvinceID;
				this.Info.WorkPlaceCityID=e.value.CityID;
				this.Info.WorkPlaceAreaID=e.value.AreaID;
				this.Info.WorkPlace=e.value.CityName;
			},
			HouseChange(e){
				this.Info.House=this.HouseList[e.detail.value];
			},
			CarChange(e){
				this.Info.Car=this.CarList[e.detail.value];
			},
			PensionChange(e){
				this.Info.Pension=this.PensionList[e.detail.value];
			},
			MarriageChange(e){
				this.Info.Marriage=this.MarriageList[e.detail.value];
			},
			FamilyChange(e){
				this.Info.Family=this.FamilyList[e.detail.value];
			},
			BrotherChange(e){
				this.Info.Brother=this.BrotherList[e.detail.value];
			},			
			
			BirthdayChange(e){
				this.Info.Birthday=e.detail.value;
			},
			InterestClick(item){
				var List=[];
				if(this.Info.Interest!=''){
					List = this.Info.Interest.split(',');
				}
				if(List.indexOf(item)>-1){
					List.Remove(item);					
				}else{
					List.push(item);
				}
				this.Info.Interest = List.join(',');
			},
			OEducationChange(e){
				this.Info.OEducation=this.OEducationList[e.detail.value];
			},
			OWorkRoleChange(e){
				this.Info.OWorkRole=this.OWorkRoleList[e.detail.value];
			},
			OHouseChange(e){
				this.Info.OHouse=this.OHouseList[e.detail.value];
			},
			OCarChange(e){
				this.Info.OCar=this.OCarList[e.detail.value];
			},
			OPensionChange(e){
				this.Info.OPension=this.OPensionList[e.detail.value];
			},
			OWorkPlaceChange(e){
				this.Info.OWorkPlaceProvinceID=e.value.ProvinceID;
				this.Info.OWorkPlaceCityID=e.value.CityID;
				this.Info.OWorkPlace=e.value.CityName;
			},
			OIncomeChange(e){
				this.Info.OIncome=this.OIncomeList[e.detail.value];
			},
			ChooseHeadImg() {
				uni.chooseImage({
					count: 1, // 默认20
					sizeType: ['original'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: res=> {
						this.Util.Loading("正在压缩，请稍候...");
						uni.compressImage({
						  src: res.tempFilePaths[0],
						  quality: 100, // 可以根据需要调整质量参数来控制压缩比例和图片质量
						  success: json=>{
							  this.Util.HideLoading();
							//this.Info.HeadImg = json.tempFilePath;
							uni.navigateTo({
								url:'/pages/login/cover?Path='+json.tempFilePath
							})
						  }
						});
					}
				});
			},
			ChooseIDCardA() {
				uni.chooseImage({
					count: 1, // 默认20
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: res=> {
						uni.compressImage({
						  src: res.tempFilePaths[0],
						  quality: 100, // 可以根据需要调整质量参数来控制压缩比例和图片质量
						  success:json=> {
							this.Info.IDCardA = json.tempFilePath;
							this.CheckIDCardA();
						  }
						});
					}
				});
			},
			ChooseIDCardB() {
				uni.chooseImage({
					count: 1, // 默认20
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: res=> {
						uni.compressImage({
						  src: res.tempFilePaths[0],
						  quality: 100, // 可以根据需要调整质量参数来控制压缩比例和图片质量
						  success:json=> {
							this.Info.IDCardB = json.tempFilePath;
						  }
						});
					}
				});
			},
			ChooseImg() {
				uni.chooseImage({
					count: 9, // 默认20
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: res=> {						
						this.Error = false;
						this.CompressImg(res.tempFilePaths);
					}
				});
			},
			CompressImg(List){
				var path = List.shift();
				uni.compressImage({
				    src: path,
				    quality: 80, // 可以根据需要调整质量参数来控制压缩比例和图片质量
				    success:json=> {
					    if(this.OldList.length + this.ImgList.length<9){
							this.ImgList.push(json.tempFilePath); 
							this.CompressImg(List);
						}else{
							if(!this.Error){
								this.Util.Alert('您最多可以上传9张照片');
								this.Error=true;
							}
						}
				  }
				});
			},
			PrevImg(ImgList, Index){
				uni.previewImage({
				  current: ImgList[Index], // 当前显示图片的http链接
				  urls: ImgList // 需要预览的图片http链接列表
				});
			},
			DeleteImg1(index){
				const self = this
				this.Util.Confirm("您确定要删除吗？",item=>{
					self.OldList.splice(index,1)
				});
			},
			DeleteImg2(index){
				const self = this
				this.Util.Confirm("您确定要删除吗？",item=>{
					self.ImgList.splice(index,1)
				});
			},
			Find_UserDetail(){
				var data = {};
				data.Act="Find_UserDetail";
				this.Util.Loading("请稍候...");
				this.Util.Post(data, json=>{
					uni.stopPullDownRefresh();
					this.Util.HideLoading();
					this.Info=json.Data.Info;
					this.OldList=json.Data.Info.LifeImgs.ToList();
					this.StatureList = this.StatureList.concat(json.Data.StatureList);
					this.WeightList = this.WeightList.concat(json.Data.WeightList);
					this.NationList = this.NationList.concat(json.Data.NationList);					
					this.IncomeList = this.IncomeList.concat(json.Data.IncomeList);
					this.EducationList = this.EducationList.concat(json.Data.EducationList);
					this.WorkRoleList = this.WorkRoleList.concat(json.Data.WorkRoleList);
					this.ProfessionList = this.ProfessionList.concat(json.Data.ProfessionList);
					this.IndustryList = this.IndustryList.concat(json.Data.IndustryList);
					this.VocationList = this.VocationList.concat(json.Data.VocationList);
					this.HouseList = this.HouseList.concat(json.Data.HouseList);
					this.CarList = this.CarList.concat(json.Data.CarList);
					this.PensionList = this.PensionList.concat(json.Data.PensionList);
					this.MarriageList = this.MarriageList.concat(json.Data.MarriageList);
					this.OMarriageList = this.OMarriageList.concat(json.Data.MarriageList);
					this.FamilyList = this.FamilyList.concat(json.Data.FamilyList);
					this.BrotherList = this.BrotherList.concat(json.Data.BrotherList);
					this.InterestList = this.InterestList.concat(json.Data.InterestList);
					
					this.OEducationList=this.OEducationList.concat(json.Data.OEducationList);
					this.OWorkRoleList=this.OWorkRoleList.concat(json.Data.OWorkRoleList);
					this.OIncomeList = this.OIncomeList.concat(json.Data.IncomeList);
					this.OHouseList=this.OHouseList.concat(json.Data.HouseList);
					this.OCarList=this.OCarList.concat(json.Data.CarList);
					this.OPensionList=this.OPensionList.concat(json.Data.PensionList);
					if(json.Data.Info.Marriage=="已结婚"){
						this.MarriageList.push("已结婚");
					}
					if(json.Data.EducationList.indexOf(json.Data.Info.Education)==-1){ 
						this.EducationList.push(json.Data.Info.Education);
					}
				});
			},

			formSubmit(e){
				var data = this.Util.ClearForm(e.detail.value);
				data.Act="Save_User";
				data.ID=this.Info.ID;
				data.Step=this.Step;
				data.Flag=this.Flag;
				data.Role=this.Role;
				data.OWorkRole = this.Info.OWorkRole;
				data.OMarriage = this.Info.OMarriage;
				if(this.Step==1){
					if(this.Info.HeadImg=="" || this.Info.HeadImg.indexOf("headimg.png")>-1){
						this.Util.Toast("请上传头像");
						return;
					}
					if(data.NickName.trim()==""){
						this.Util.Toast("请填写昵称");
						return;
					}
					if(data.NickName.FormLength()>10){
						this.Util.Toast("昵称最多输入5个汉字");
						return;
					}					
					if(data.Sex.trim()=="" || data.Sex.trim()=="请选择"){
						this.Util.Toast("请选择性别");
						return;
					}
					if(data.Mobile.trim()==""){
						this.Util.Toast("请填写手机号码");
						return;
					}
					
					if(!this.Validate.IsMobile(data.Mobile.trim())){
						this.Util.Toast("手机号码不正确");
						return;
					}				
					if(data.WeiXin.trim()==""){
						this.Util.Toast("请填写微信号");
						return;
					}
					if(this.Info.IDCardA==''){
						this.Util.Toast("请上传身份证正面照片");
						return;
					}
					if(this.Info.IDCardB==''){
						this.Util.Toast("请上传身份证反面照片");
						return;
					}
					if(data.RealName.trim()==""){
						this.Util.Toast("请填写姓名");
						return;
					}
					if(data.RealName.FormLength()>10){
						this.Util.Toast("姓名最多输入5个汉字");
						return;
					}
					if(data.IDCard.trim()==""){
						this.Util.Toast("请填写身份证号");
						return;
					}
					if(!this.Validate.IsIDCard(data.IDCard.trim())){
						this.Util.Toast("身份证号不正确");
						return;
					}
					if(data.Birthday.trim()==""){
						this.Util.Toast("请选择出生日期");
						return;
					}
					if(data.Stature.trim()==""){
						this.Util.Toast("请选择身高");
						return;
					}
					if(data.Weight.trim()==""){
						this.Util.Toast("请选择体重");
						return;
					}
					if(data.Nation.trim()==""){
						this.Util.Toast("请选择民族");
						return;
					}
				}
				if(this.Step==2){
					if(data.Income.trim()==""){
						this.Util.Toast("请选择年收入");
						return;
					}
					if(data.Education.trim()==""){
						this.Util.Toast("请选择最高学历");
						return;
					}
					if(data.WorkRole.trim()==""){
						this.Util.Toast("请选择从事的职业");
						return;
					}
					if(data.WorkPlace.trim()==""){
						this.Util.Toast("请选择工作区域");
						return;
					}
				}
				if(this.Step==3){ 
					if(data.House.trim()==""){
						this.Util.Toast("请选择是否有房");
						return;
					}
					if(data.Car.trim()==""){
						this.Util.Toast("请选择是否有车");
						return;
					}
				}
				if(this.Step==5){
					if(data.OAge.trim()==""){
						this.Util.Toast("请选择年龄");
						return;
					}
					if(data.OStature.trim()==""){
						this.Util.Toast("请选择身高");
						return;
					}
					if(data.OEducation.trim()==""){
						this.Util.Toast("请选择最高学历");
						return;
					}
					if(data.OWorkRole.trim()==""){
						this.Util.Toast("请选择工作");
						return;
					}
					if(data.OHouse.trim()==""){
						this.Util.Toast("请选择是否有房");
						return;
					}
					if(data.OCar.trim()==""){
						this.Util.Toast("请选择是否有车");
						return;
					}
					if(data.IsAgree==""){
						this.Util.Toast("请承诺信息全部真实");
						return;
					}
					if(data.IsAgree=="2"){
						this.Util.Toast("你已弃权注册");
						return;
					}
				}
				this.Util.Loading("请稍候..."); 
				var Paths=[this.Info.HeadImg, this.Info.IDCardA, this.Info.IDCardB];
				Paths = Paths.concat(this.OldList).concat(this.ImgList);
				this.Util.Upload(Paths,"upload_file_o",[],list=>{
					data.HeadImg=list[0];this.Info.HeadImg=list[0];
					data.IDCardA=list[1];this.Info.IDCardA=list[1];
					data.IDCardB=list[2];this.Info.IDCardB=list[2];
					list.RemoveAt(0);
					list.RemoveAt(0); 
					list.RemoveAt(0);
					data.LifeImgs = list.join(',');
					this.OldList=list;
					this.ImgList=[];
					var timer=0; //如果有图片，则延迟1秒再提交，等待服务器分析图片是否合规
					if(this.Step==1 || this.Step==4){
						timer = 1000;
					}
					setTimeout(()=>{
						this.Save(data);
					},timer);
					
				});				
			},
			CheckIDCardA(){
				this.Util.Loading("正在识别..."); 
				this.Util.OneUpload(this.Info.IDCardA, "upload_file_n", json=>{
					this.Util.HideLoading();
					if(json.State){
						this.Info.IDCardA = json.Data.Path;
						this.Info.RealName = json.Data.RealName;
						this.Info.IDCard = json.Data.IDCard;
						this.Info.Birthday = json.Data.Birthday;
						this.Info.Sex = json.Data.Sex;
						if(this.Info.Sex=="男" && this.Info.Stature==0){
							this.Info.Stature=175;
							this.Info.Weight=70;
						}
						if(this.Info.Sex=="女" && this.Info.Stature==0){
							this.Info.Stature=165;
							this.Info.Weight=55;
						}
						this.Util.Toast(json.Msg);
					}else{
						this.Util.Alert(json.Msg);
					}
				});
			},
			Save(data){
				data.Stature=data.Stature.FilterChinese();
				data.Weight=data.Weight.FilterChinese();
				this.Util.Post(data, json=>{
					this.Util.HideLoading();
					if(json.State){
						uni.$emit("RegistSuccess");
						if(this.Step==5){
							uni.navigateTo({
								url:'/pages/index/registsuccess?Role='+this.Role+'&Tip='+json.Msg+'&IsIdentify='+this.Info.IsIdentify
							})
						}else{
							this.Step++;
						}
					}else{
						this.Util.Alert(json.Msg);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page{background-image: url(https://yuehuiba.qiyedaishu.com/img/bg4.png); background-color: #9e1810; background-size: 100%; background-repeat: no-repeat;}
	form{width:100%;}
	.container{padding-bottom: 30rpx; padding-top:200rpx; 
		.error{width:710rpx; margin-left:20rpx; height:auto; margin:0 auto; border-radius: 20rpx; margin-top:0rpx; margin-bottom: 20rpx; padding:20rpx; line-height: 40rpx; float:left; background-color: #fdc8d0; border:1rpx solid #fdc8d0; color:#f70225; text-align: left;}
		.back{width:60rpx !important; height:60rpx !important; border-radius: 30rpx !important; padding-left:0rpx !important; background-color: #ffffff; opacity: 0.5; position:absolute; left:20rpx; z-index:99;
			image{width:34rpx; height: 34rpx; margin-top:14rpx; margin-left: 12rpx; transform: rotate(90deg);}
		}
	}
	.square{width:710rpx; margin-left:20rpx; height:auto; margin:0 auto; padding:40rpx; padding-top:0rpx; background-color: #ffffff; opacity: 1; border-radius: 40rpx; display:flex; flex-direction: row; flex-wrap: wrap;
		.promise{width:100%; height:auto; font-size:30rpx; color:red; padding-top:30rpx;}
		.aware{width:100%; height:auto; font-size:30rpx; color:red; padding-bottom:30rpx; padding-top:30rpx; margin-bottom: 20rpx;}
		.agree{width:100%; height:auto; margin-top:-30rpx; padding-bottom:30rpx;
			radio-group{display: flex; flex-direction: row;
				label{width:250rpx; display: flex; flex-direction: row;
					.r1{height:50rpx; line-height: 60rpx;}
					.r2{padding-left:10rpx;height:60rpx; line-height: 60rpx; font-size:32rpx;}
				}
			}
		}
		.head{width:100%; min-height: 190rpx;
			.title{width:100%; height:60rpx; float:left; font-size:32rpx;}
			.upload{width:30%; height: 100rpx; float:left; overflow: hidden; image{width:100rpx; height:100rpx; border-radius: 50rpx;}}
			.upload:active{opacity: 0.6;}
			.tip{width:70%; height: 100rpx; line-height: 100rpx; font-size:30rpx; float:left; text-align: right; color:#7d7d7d;}
			
		}
		.card{width:100%; min-height: 310rpx; 
			.title{width:100%; height:60rpx; margin-top:20rpx; float:left; font-size:32rpx;}
			.idcard{width:305rpx; height: 200rpx; float:left; padding:1rpx; border:1rpx dashed #cdcdcd; border-radius: 0rpx; overflow: hidden; image{width:100%; height:100%;}}
			.idcard:last-child{margin-left:20rpx;}
			.idcard:active{opacity: 0.6;}
		}
		.login{width:100%; height: 100rpx; line-height: 100rpx; margin-top:50rpx; font-size:36rpx; color:#fff; background-color: #c94c36; border-radius:50rpx;}
		.cancel{width:100%; height: 120rpx; line-height: 120rpx; font-size:30rpx; text-align: center; color:#a8a8a8; background-color: transparent;}
	}
	.group{width:100%; height:80rpx; font-size:32rpx; margin-top:0rpx; color:#3d7dfd; background-color: #ffffff;
		.number{color:#747474; padding-right:0rpx; float:right; font-size:28rpx;}
		.resign{color:#00c1a8; padding-right:30rpx; float:right;}
	}	
	.step5{display: flex; flex-direction: column;}
	.squarelist{width:100%; height:auto; padding-bottom: 20rpx; background-color: #ffffff; display: flex; flex-direction: row; justify-content: space-between; flex-wrap: wrap;
		.line{width:148rpx; height: 70rpx; line-height: 70rpx; margin-bottom: 10rpx; background-color: #f0f0f0; color:#4d4d4d; border-radius: 10rpx; text-align: center;}
		.line:last-child{margin-right: 0rpx;}
		.select{background-color: #c94c36; color:#ffffff;}
	}
	.imglist{width:100%; height:auto; padding-bottom: 20rpx; background-color: #ffffff; display: flex; flex-direction: row; flex-wrap: wrap;
		.img{width:190rpx; height:190rpx; position: relative; margin-left:30rpx; margin-bottom:20rpx; border-radius: 10rpx;
			.delete{width:40rpx; height:40rpx; position:absolute; right:-15rpx; top:-15rpx;}
			image{width:100%; height: 100%; border-radius: 10rpx;}
		}
		.img:nth-child(3n-2){margin-left:0rpx;}
		.bd{border:1rpx solid #bfbfbf;}
	}
	.slider{width:100%; height: 150rpx;
		.title{width:100rpx; padding-top:50rpx; float:left; font-size: 32rpx;}
		.text{width:calc(100% - 100rpx); float:left;} 
	}
	.menutitle{width:100%; height:80rpx; line-height: 80rpx; font-size:32rpx; text-align: center;}
	.checkbox{width:100%; height:auto; display: flex; flex-direction: row; justify-content: space-between; flex-wrap: wrap; padding:30rpx; padding-top:60rpx;
		.list{width:200rpx; height:70rpx; line-height:70rpx; font-size:32rpx; text-align: center; margin-bottom: 30rpx; border:1rpx solid #cdcdcd;}
		.list:nth-child(5n){margin-right:0rpx;}
		.select{background-color: #3d7dfd; border:1rpx solid #3d7dfd; color:#ffffff;}
		.list:active{background-color: #3d7dfd; border:1rpx solid #3d7dfd; color:#ffffff;}
	}
	.flow{width:750rpx; height:100vh; position: fixed; left:0rpx; top:0rpx; z-index:9999;overflow-y: scroll; 
		.meng{width:100vw; height:100vh; background-color: #000000; position: fixed; left:0rpx; top:0rpx; opacity: 0.6;}
		.img{width:650rpx; height:100vh; position: absolute; left:50rpx; top:100rpx; 
			.flowimg{width:100%; height:auto; image{width:100%; height:1400rpx; border-radius:20rpx; overflow: hidden;}}
			.close{width:100%; height:50rpx; margin-top:20rpx; text-align: center; image{width:50rpx; height:50rpx;}}
		}
	}
</style>
